/**
 * Created by Administrator on 2016/10/16.
 */
var express = require("express");
var router = express.Router();
var _ = require("underscore");

var connection = require('../../lib/utils/DbconnectUtil');

/**
 * 查询项目列表
 */
router.get('/', function (req, res, next) {
    var messageSql = 'select t_message.id id, t_message.userName userName, t_message.contact contact, t_message.message message, t_message.contentId contentId, t_content.name contentName from t_message left join t_content on t_message.contentId = t_content.id';
    connection().query(messageSql, function (error, results) {
        if (error) {
            res.send({code : -1 , message: JSON.stringify(error)});
        } else {
            console.log(JSON.stringify(results));
            res.send({code :0 , data : results});
        }
    });
});


module.exports = router;